﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BibleBase
{
    [Serializable]
    public class Chapter
    {
        public int Number { get; set; }
        public List<Verse> Verses { get; set; }

        public Chapter()
        {
            Verses = new List<Verse>();
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine(string.Format("Capitulo: {0}", Number));
            sb.AppendLine();
            Verses.ForEach(x => sb.AppendLine(x.ToString()));
            return sb.ToString();
        }

        private static int CompareVerses(Verse a, Verse b) { return a.Number - b.Number; }

        public void Sort()
        {
            Verses.Sort(CompareVerses);
        }
    }
}
